Skip to content

Conversation

ritesh006
Copy link
Contributor

@ritesh006 ritesh006 commented Oct 3, 2025

Enhance the ESP32 WebServer library by introducing native support for chunked transfer encoding. This allows streaming large or dynamic content efficiently, improving scalability and performance. Adds three main methods: chunkedResponseModeStart(), sendChunk(), and chunkedResponseFinalize() for easy, reliable implementation of chunked responses

Fixes #5080

@ritesh006 ritesh006 requested a review from a team as a code owner October 3, 2025 14:17
@CLAassistant
Copy link

CLAassistant commented Oct 3, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Add chunkedResponseModeStart, sendChunk, chunkedResponseFinalize":
    • summary looks empty
    • type/action looks empty
    • body must have leading blank line
  • the commit message "feat(webserver): Chunk example for ESP32 HTTP server":
    • body's lines must not be longer than 100 characters

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 Hello ritesh006, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against dfaa04b

@ritesh006 ritesh006 changed the title Add chunked HTTP response support to ESP32 Arduino WebServer library Fixes #5080 feat(webserver): add support for chunked HTTP responses Fixes #5080 Oct 3, 2025
}

void WebServer::sendChunk(const char* data, size_t length) {
if (!_chunkedResponseActive) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log_e that chunk response has not been started

@me-no-dev
Copy link
Member

Please also add a small example to showcase the usage

@ritesh006 ritesh006 force-pushed the feature/chunked-response branch from c1a5c63 to bf6aed6 Compare October 3, 2025 14:42
to WebServer library for chunked HTTP responses
@ritesh006 ritesh006 force-pushed the feature/chunked-response branch from bf6aed6 to f4f8762 Compare October 3, 2025 14:57
@ritesh006
Copy link
Contributor Author

Ready for Review

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Test Results

 76 files   76 suites   13m 52s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit dfaa04b.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C50⚠️ +460.000.000⚠️ +640.00⚠️ +0.14
ESP32P40⚠️ +460.00⚠️ +0.010⚠️ +640.00⚠️ +0.20
ESP32S30⚠️ +1520.00⚠️ +0.020⚠️ +560.00⚠️ +0.12
ESP32S20⚠️ +1560.00⚠️ +0.020⚠️ +560.00⚠️ +0.14
ESP32C30⚠️ +460.000.000⚠️ +640.00⚠️ +0.18
ESP32C60⚠️ +460.000.000⚠️ +640.00⚠️ +0.15
ESP320⚠️ +1600.00⚠️ +0.020⚠️ +560.00⚠️ +0.12
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32P4ESP32S3ESP32S2ESP32C3ESP32C6ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/DNSServer/examples/CaptivePortal⚠️ +16⚠️ +64⚠️ +12⚠️ +48⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +16⚠️ +64⚠️ +16⚠️ +48⚠️ +116⚠️ +56
libraries/HTTPUpdateServer/examples/WebUpdater⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +120⚠️ +56⚠️ +120⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +48⚠️ +116⚠️ +56
libraries/Update/examples/HTTP_Server_AES_OTA_Update⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56⚠️ +116⚠️ +56⚠️ +16⚠️ +48⚠️ +12⚠️ +48⚠️ +116⚠️ +56
libraries/Update/examples/OTAWebUpdater⚠️ +12⚠️ +64⚠️ +12⚠️ +48⚠️ +120⚠️ +56⚠️ +124⚠️ +56⚠️ +12⚠️ +64⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/AdvancedWebServer⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56⚠️ +120⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/ChunkWriting--------------
libraries/WebServer/examples/FSBrowser⚠️ +12⚠️ +64⚠️ +12⚠️ +48⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +12⚠️ +64⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/Filters⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HelloServer⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HttpAdvancedAuth⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +16⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HttpAuthCallback⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56⚠️ +116⚠️ +56⚠️ +16⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HttpAuthCallbackInline⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56⚠️ +116⚠️ +56⚠️ +16⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HttpBasicAuth⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +16⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/HttpBasicAuthSHA1⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +116⚠️ +56⚠️ +120⚠️ +56⚠️ +12⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56
libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +12⚠️ +48⚠️ +16⚠️ +48⚠️ +112⚠️ +56
libraries/WebServer/examples/Middleware⚠️ +12⚠️ +64--⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +12⚠️ +64⚠️ +12⚠️ +48⚠️ +124⚠️ +56
libraries/WebServer/examples/MultiHomedServers⚠️ +460⚠️ +460⚠️ +1520⚠️ +1560⚠️ +460⚠️ +460⚠️ +1600
libraries/WebServer/examples/PathArgServer⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +112⚠️ +56⚠️ +116⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +64⚠️ +120⚠️ +56
libraries/WebServer/examples/SDWebServer⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +12⚠️ +48⚠️ +12⚠️ +48⚠️ +116⚠️ +56
libraries/WebServer/examples/SimpleAuthentification⚠️ +16⚠️ +64⚠️ +16⚠️ +48⚠️ +112⚠️ +56⚠️ +116⚠️ +56⚠️ +16⚠️ +64⚠️ +16⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/UploadHugeFile⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56⚠️ +116⚠️ +56⚠️ +12⚠️ +48⚠️ +12⚠️ +64⚠️ +116⚠️ +56
libraries/WebServer/examples/WebServer⚠️ +12⚠️ +48⚠️ +16⚠️ +64⚠️ +116⚠️ +56⚠️ +120⚠️ +56⚠️ +16⚠️ +48⚠️ +16⚠️ +48⚠️ +116⚠️ +56
libraries/WebServer/examples/WebUpdate⚠️ +12⚠️ +64⚠️ +12⚠️ +48⚠️ +112⚠️ +56⚠️ +112⚠️ +56⚠️ +12⚠️ +64⚠️ +12⚠️ +48⚠️ +112⚠️ +56

@ritesh006
Copy link
Contributor Author

Hi @me-no-dev May I please know when this commit is planned to be merged?

@me-no-dev me-no-dev added the Status: Review needed Issue or PR is awaiting review label Oct 4, 2025
@me-no-dev
Copy link
Member

@ritesh006 let's give a chance for others to review as well. It will be part of next release

@ritesh006
Copy link
Contributor Author

@ritesh006 let's give a chance for others to review as well. It will be part of next release

Yes thank so much

@SuGlider SuGlider self-requested a review October 4, 2025 19:22
Copy link
Collaborator

@SuGlider SuGlider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Thanks @ritesh006 for the PR!

$ curl -i esp32_chunk_resp.local:80
HTTP/1.1 200 OK
Content-Type: text/plain
Accept-Ranges: none
Transfer-Encoding: chunked
Connection: close

10...
9...
8...
7...
6...
5...
4...
3...
2...
1...
DONE!

This example demonstrates how to send an HTTP response using chunks with an ESP32 server. It includes setup for WiFi, MDNS, and handles HTTP requests with chunked responses.
@SuGlider SuGlider requested a review from lucasssvaz as a code owner October 4, 2025 19:31
@ritesh006
Copy link
Contributor Author

Thank You @SuGlider

@me-no-dev me-no-dev added Status: Pending Merge Pull Request is ready to be merged and removed Status: Review needed Issue or PR is awaiting review labels Oct 6, 2025
@me-no-dev
Copy link
Member

@lucasssvaz PTAL

Copy link
Member

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@me-no-dev me-no-dev merged commit 9d44061 into espressif:master Oct 6, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Merge Pull Request is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webserver :Please add chunkedResponseModeStart / chunkedResponseFinalize
6 participants